package com.ruoyi.iot.constant;


public enum LiveViewTypeEnum {
    /**
     * 声网
     */
    AGORA(0,"agora"),
    /**
     * rtmp
     */
    RTMP(1,"rtmp"),
    /**
     * rtsp
     */
    RTSP(2,"rtsp"),
    /**
     * webrtc
     */
    WEBRTC(3,"webrtc"),
    /**
     * 萤石云
     */
    YS7(4,"ys7"),
    /**
     * H5页面
     */
    H5(5,"h5"),
    /**
     * 未知
     */
    UNKNOWN(-1,"-1");

    private String val;
    private int type;

    LiveViewTypeEnum(String val) {
        this.val = val;
    }

    LiveViewTypeEnum(int type,String val) {
        this.type=type;
        this.val = val;
    }

    public int getType(){
        return this.type;
    }

    public String getVal(){
        return this.val;
    }

    /**
     * 查找类型
     * @param val
     * @return
     */
    public static LiveViewTypeEnum find(String val) {
        for (LiveViewTypeEnum typeEnum:LiveViewTypeEnum.values()) {
            if(typeEnum.val.equals(val)){
                return typeEnum;
            }
        }
        return UNKNOWN;
    }


    /**
     * 查找类型
     * @param type
     * @return
     */
    public static LiveViewTypeEnum find(int type) {
        for (LiveViewTypeEnum typeEnum:LiveViewTypeEnum.values()) {
            if(typeEnum.type==type){
                return typeEnum;
            }
        }
        return UNKNOWN;
    }
}
